//
//  DXCustomViewController.m
//  UILbrary
//
//  Created by mac on 16/9/27.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "DXCustomViewController.h"
#import "DXCustomPickerVeiw.h"
@interface DXCustomViewController ()
@property (nonatomic, strong) DXCustomPickerVeiw *pickerView;
@end

@implementation DXCustomViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.view.backgroundColor = [UIColor orangeColor];
    UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
    [button setTitle:@"选择" forState:UIControlStateNormal];
    button.titleLabel.font = [UIFont systemFontOfSize:11.0];
    [button addTarget:self action:@selector(buttonClick) forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem *rightBarButton = [[UIBarButtonItem alloc] initWithCustomView:button];
    self.navigationItem.rightBarButtonItem = rightBarButton;
}

- (void)buttonClick{
    /*
     [self.view addSubview:self.pickerView];
     [self.pickerView show];
     */
    
    [DXCustomPickerVeiw show];
}



#pragma mark - lazy

- (DXCustomPickerVeiw *)pickerView{
    if (!_pickerView) {
        _pickerView = [[DXCustomPickerVeiw alloc] initWithFrame:self.view.bounds];
    }
    return _pickerView;
}




@end
